<div id="editor"></div>

<script>
	var editor = CKEDITOR.replace( 'editor', {
		extraPlugins: 'test1'
	} );

	CKEDITOR.plugins.add( 'test1', {
		requires: 'widget',
		init: function( editor ) {
			editor.widgets.add( 'test1', {
				button: 'Create autoparagraph test',
				pathName: 'test-widget',

				template:
					'<div class="test1">' +
						'<div class="content"></div>' +
					'</div>',

				editables: {
					content: {
						selector: '.content',
						allowedContent: 'br'
					}
				},

				allowedContent: 'div(test1,content)',
				requiredContent: 'div(test1)',

				upcast: function( element ) {
					return element.name == 'div' && element.hasClass( 'test1' );
				}
			} );
		}
	} );

	editor.once( 'pluginsLoaded', function( evt ) {
		editor.setData( '<p>foo</p><div class="test1">x<div class="content">Edit me...</div>y</div> ' );
	} );
</script>
